<template>
  <el-form :model="ruleForm" ref="ruleForm"
           class="elForm" :class="isEdit?'':'formItem'"
           :inline="false">

    <el-card class="box-card">
      <div slot="header" class="header-card">
        <span class="header-card-title">基础信息</span>
      </div>

      <el-row :gutter="24">
        <el-col :span="8">
          <el-form-item label="车架号:">
            <span>{{ ruleForm.vinNo }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="车牌号:">
            <span>{{ ruleForm.carNo }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="品牌/车型/车款:">
            <span>{{ ruleForm.brandName }}</span>
            <span>{{ ruleForm.seriesName }}</span>
            <span>{{ ruleForm.modelName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="车辆归属:">
            <span>{{ ruleForm.ascription }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="保险编号:" >
            <span>{{ ruleForm.workOrderCode }}</span>
          </el-form-item>
        </el-col>
      </el-row>

    </el-card>
  </el-form>
</template>

<script>
export default {
  name: 'basicsInfo',//基础信息
  props: {
    value: {
      type: Object,
      default: {},
    },
    state: {
      type: String,
      default: '',
    },
  },
  computed: {
    ruleForm: {
      get() {
        let that = this;
        const proxy = new Proxy(that.value, {
          get(target, key) {
            return Reflect.get(target, key);
          },
          set(target, key, value) {
            that.$emit("input", {...target, [key]: value});
            return true;
          },
        });
        return proxy;
      },
    },
    labelPosition() {
      if (this.state === 'write') {
        return 'top'
      } else {
        return 'right'
      }
    },
    isEdit() {
      let bool;
      switch (this.state) {
        case "write":
          bool = true;
          break;
        case "disabled":
          bool = false;
          break;
        case "readonly":
          bool = false;
          break;
      }
      return bool
    }
  },
  data() {
    return {};
  },
  created() {
  },
  mounted() {
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
@import "@/styles/cwgd/formScss.scss";

.elForm {
  .el-form-item {
    width: 100%;
  }
}
</style>



